package phase01.module2.code.question3;

public class DataPlan extends Plan implements IDataService {
    private int dataInByte;

    public DataPlan(int dataInByte, double monthlyCharge) {
        super(monthlyCharge);
        setDataInByte(dataInByte);
    }

    @Override
    public void show() {
        System.out.println("=============================================================");
        System.out.println("流量套餐：");
        System.out.println("上网流量：" + getDataInByte() + "字节");
        System.out.println("每月资费：" + getMonthlyCharge() + "元");
    }

    public int getDataInByte() {
        return dataInByte;
    }

    public void setDataInByte(int dataInByte) {
        this.dataInByte = dataInByte;
    }

    @Override
    public void request(int dataSize, SIM sim) {
        Invoice invoice = sim.getInvoice();
        invoice.setDataUsed(dataSize);
        System.out.println("=============================================================");
        System.out.println("套餐上网：");
        System.out.println("电话卡：" + sim.getNumber());
        System.out.println("电话卡：" + sim.getUsername());
        System.out.println("使用流量：" + dataSize + "字节");
    }
}
